package Demo4;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ret = 1;
        while (true){
            if (ret > N){
                break;
            }
            ret *= 2;
        }
        ret /= 2;
        System.out.println(ret);
    }
}
